package com.ss.android.article.base.feature.detail2.picgroup;

import android.support.v4.app.FragmentActivity;
import android.view.MotionEvent;
import com.ss.android.article.base.feature.detail2.picgroup.view.PictureDetailLayout;
import com.ss.android.article.base.feature.detail2.view.NewDetailActivity;
import com.ss.android.article.base.ui.SwipeBackLayout.b;

final class j implements b {
    public final GalleryFragment a;
    private final boolean b;

    j(GalleryFragment arg1, boolean arg2) {
        this.a = arg1;
        this.b = arg2;

    }

    public final void a(int arg5, int arg6) {
        if(!this.a.o() && (this.a.i.j.k.a(arg5, arg6, false))) {
            FragmentActivity v0 = this.a.getActivity();
            int v2 = Math.abs(arg5);
            float v1 = ((float)(arg6 / 255));
            if(((NewDetailActivity)v0).mRoot != null && ((NewDetailActivity)v0).mRoot.getHeight() != 0) {
                v1 = Math.max(1f - (((float)v2)) * 10f / (((float)((NewDetailActivity)v0).mRoot.getHeight())), 0f);
            }

            ((NewDetailActivity)v0).mDetailTitleBar.setAlpha(v1);
            ((NewDetailActivity)v0).mDetailToolBar.setAlpha(v1);
            android.support.design.a.a(((NewDetailActivity)v0).mRoot, arg6);
        }
    }

    public final boolean a(MotionEvent arg6, int arg7) {
        int v4 = 2;
        boolean v0 = false;
        if(!this.a.w() || !this.a.b(this.a.i)) {
            if(!this.a.x()) {
                return v0;
            }

            if(!this.a.c(this.a.i)) {
                return v0;
            }

            if(this.a.i.j.t) {
                return v0;
            }

            if(this.a.i.j.s) {
                return v0;
            }

            if(arg6.getActionMasked() == 0) {
                if(arg6.getY() >= (((float)this.a.g))) {
                    return v0;
                }

                if(!this.a.i.j.v && (this.a.f)) {
                    return v0;
                }

                return true;
            }

            if(arg7 == v4) {
                if(!this.b) {
                    return v0;
                }

                if(!this.a.i.j.v && (this.a.f)) {
                    return v0;
                }

                return true;
            }

            if(arg7 != 0) {
                return v0;
            }

            if(this.a.i.j.v) {
                return v0;
            }

            if(this.a.f) {
                return v0;
            }

            if(this.a.i.j.A != 0) {
                return v0;
            }

            v0 = true;
        }
        else if(!this.a.i.j.t && !this.a.i.j.s) {
            PictureDetailLayout v2 = this.a.i.j.k;
            if(arg6.getActionMasked() == 0) {
                if(!v2.a(v4, arg6.getY()) && !v2.a(0, arg6.getY())) {
                    return v0;
                }

                v0 = true;
            }
            else {
                if(!this.b && arg7 != 0) {
                    return v0;
                }

                if(!v2.a(arg7, arg6.getY())) {
                    return v0;
                }

                v0 = true;
            }
        }

        return v0;
    }

    public final void b(int arg5, int arg6) {
        int v3 = 255;
        if(!this.a.o() && (this.a.i.j.k.a(arg5, null))) {
            if(Math.abs(arg5) * 6 < this.a.e.getHeight()) {
                ((NewDetailActivity)this.a.getActivity()).startTitleAnim(0, arg6, v3);
                this.a.i.j.k.a(0, v3, true);
            }
            else {
                ((NewDetailActivity)this.a.getActivity()).startTitleAnim(this.a.e.getHeight(), arg6, 0);
                this.a.i.j.k.a(arg5, new k(this));
            }
        }
    }
}

